/************************************************************************

								Heroes IV
					  Copyright 2001, The 3DO Company

	------------------------------------------------------------------
  						 combat_ai_spell_single_action.h

	$Header: $

	$NoKeywords: $

 ************************************************************************/

#if !defined( COMBAT_AI_SPELL_SINGLE_ACTION_H_INCLUDED )
#define COMBAT_AI_SPELL_SINGLE_ACTION_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "abstract_combat_ai_spell_action.h"
#include "combat_creature_ptr.h"
#include "combat_spell_single_target.h"

// A representation of the "cast a single target spell" action
class t_combat_ai_spell_single_action : public t_abstract_combat_ai_spell_action
{
	public:
		t_combat_ai_spell_single_action( t_battlefield&					battlefield,
										 t_combat_spell_single_target*	spell,
										 t_combat_creature_ptr			target, 
									     bool							never_use = false, 
										 double							weight = std::numeric_limits<double>::quiet_NaN(),
										 double							sp_adjusted_weight = std::numeric_limits<double>::quiet_NaN());


		t_combat_spell_single_target * get_single_spell() const;
		t_combat_creature_ptr	get_target() const;


		virtual void weigh_action(t_combat_ai const& owner);
		virtual void perform_action(void);

	private:
		t_combat_spell_single_target  * m_single_spell; // t_abstract_combat_ai_spell_action::m_spell, with correct type
		const t_combat_creature_ptr	    m_target; // Target of spell
};


inline 
t_combat_ai_spell_single_action::t_combat_ai_spell_single_action(
							     t_battlefield&					battlefield,
								 t_combat_spell_single_target*  spell,
								 t_combat_creature_ptr			target, 
								 bool							never_use,
								 double							weight,
								 double							sp_adjusted_weight)
	: t_abstract_combat_ai_spell_action( battlefield, spell, never_use, weight, sp_adjusted_weight), m_single_spell(spell), m_target(target)
{

}

inline
t_combat_spell_single_target * t_combat_ai_spell_single_action::get_single_spell() const
{
	return m_single_spell;
}

inline
t_combat_creature_ptr t_combat_ai_spell_single_action::get_target() const
{
	return m_target;
}


#endif // COMBAT_AI_SPELL_SINGLE_ACTION_H_INCLUDED
